home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
Tutorial
/
Cookbook
/
13.pie_slice
/
slice.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-12
|
11KB
|
310 lines
/* slice.c generated from slice.psw
by unix pswrap V1.009 Wed Apr 19 17:50:24 PDT 1989
*/
#include <dpsclient/dpsfriends.h>
#include <string.h>
#line 1 "slice.psw"
#line 10 "slice.c"
void doLine(float ox, float oy, float dx, float dy)
{
typedef struct {
unsigned char tokenType;
unsigned char topLevelCount;
unsigned short nBytes;
DPSBinObjGeneric obj0;
DPSBinObjGeneric obj1;
DPSBinObjGeneric obj2;
DPSBinObjReal obj3;
DPSBinObjReal obj4;
DPSBinObjGeneric obj5;
DPSBinObjReal obj6;
DPSBinObjReal obj7;
DPSBinObjGeneric obj8;
DPSBinObjGeneric obj9;
} _dpsQ;
static const _dpsQ _dpsStat = {
DPS_DEF_TOKENTYPE, 10, 84,
{DPS_LITERAL|DPS_INT, 0, 0, 5},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 155}, /* setlinewidth */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 111}, /* newpath */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: ox */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: oy */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 107}, /* moveto */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: dx */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: dy */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 133}, /* rlineto */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 167}, /* stroke */
}; /* _dpsQ */
_dpsQ _dpsF; /* local copy */
register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
char pad[3];
register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
_dpsF = _dpsStat; /* assign automatic variable */
_dpsP[3].val.realVal = ox;
_dpsP[4].val.realVal = oy;
_dpsP[6].val.realVal = dx;
_dpsP[7].val.realVal = dy;
DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,84);
if (0) *pad = 0; /* quiets compiler warnings */
}
#line 7 "slice.psw"
#line 57 "slice.c"
void doArc(float ox, float oy, float r, float ang1, float ang2)
{
typedef struct {
unsigned char tokenType;
unsigned char topLevelCount;
unsigned short nBytes;
DPSBinObjGeneric obj0;
DPSBinObjGeneric obj1;
DPSBinObjReal obj2;
DPSBinObjReal obj3;
DPSBinObjReal obj4;
DPSBinObjReal obj5;
DPSBinObjReal obj6;
DPSBinObjGeneric obj7;
DPSBinObjGeneric obj8;
} _dpsQ;
static const _dpsQ _dpsStat = {
DPS_DEF_TOKENTYPE, 9, 76,
{DPS_LITERAL|DPS_INT, 0, 0, 10},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 155}, /* setlinewidth */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: ox */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: oy */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: r */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: ang1 */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: ang2 */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 5}, /* arc */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 167}, /* stroke */
}; /* _dpsQ */
_dpsQ _dpsF; /* local copy */
register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
char pad[3];
register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
_dpsF = _dpsStat; /* assign automatic variable */
_dpsP[2].val.realVal = ox;
_dpsP[3].val.realVal = oy;
_dpsP[4].val.realVal = r;
_dpsP[5].val.realVal = ang1;
_dpsP[6].val.realVal = ang2;
DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,76);
if (0) *pad = 0; /* quiets compiler warnings */
}
#line 13 "slice.psw"
#line 103 "slice.c"
void drawSlice(float grayshade, float radius, float startangle, float endangle, float labelps, const char *thelabel)
{
typedef struct {
unsigned char tokenType;
unsigned char sizeFlag;
unsigned short topLevelCount;
unsigned long nBytes;
DPSBinObjGeneric obj0;
DPSBinObjGeneric obj1;
DPSBinObjGeneric obj2;
DPSBinObjGeneric obj3;
DPSBinObjGeneric obj4;
DPSBinObjGeneric obj5;
DPSBinObjGeneric obj6;
DPSBinObjGeneric obj7;
DPSBinObjReal obj8;
DPSBinObjReal obj9;
DPSBinObjReal obj10;
DPSBinObjGeneric obj11;
DPSBinObjGeneric obj12;
DPSBinObjReal obj13;
DPSBinObjGeneric obj14;
DPSBinObjGeneric obj15;
DPSBinObjReal obj16;
DPSBinObjGeneric obj17;
DPSBinObjGeneric obj18;
DPSBinObjGeneric obj19;
DPSBinObjGeneric obj20;
DPSBinObjGeneric obj21;
DPSBinObjReal obj22;
DPSBinObjReal obj23;
DPSBinObjGeneric obj24;
DPSBinObjGeneric obj25;
DPSBinObjGeneric obj26;
DPSBinObjGeneric obj27;
DPSBinObjReal obj28;
DPSBinObjGeneric obj29;
DPSBinObjGeneric obj30;
DPSBinObjGeneric obj31;
DPSBinObjGeneric obj32;
DPSBinObjGeneric obj33;
DPSBinObjGeneric obj34;
DPSBinObjReal obj35;
DPSBinObjReal obj36;
DPSBinObjGeneric obj37;
DPSBinObjGeneric obj38;
DPSBinObjGeneric obj39;
DPSBinObjGeneric obj40;
DPSBinObjReal obj41;
DPSBinObjGeneric obj42;
DPSBinObjGeneric obj43;
DPSBinObjGeneric obj44;
DPSBinObjGeneric obj45;
DPSBinObjGeneric obj46;
DPSBinObjGeneric obj47;
DPSBinObjGeneric obj48;
DPSBinObjGeneric obj49;
DPSBinObjGeneric obj50;
DPSBinObjGeneric obj51;
DPSBinObjGeneric obj52;
DPSBinObjGeneric obj53;
DPSBinObjGeneric obj54;
DPSBinObjGeneric obj55;
DPSBinObjGeneric obj56;
DPSBinObjGeneric obj57;
DPSBinObjGeneric obj58;
DPSBinObjGeneric obj59;
DPSBinObjGeneric obj60;
DPSBinObjGeneric obj61;
DPSBinObjGeneric obj62;
DPSBinObjGeneric obj63;
DPSBinObjGeneric obj64;
DPSBinObjGeneric obj65;
DPSBinObjGeneric obj66;
DPSBinObjGeneric obj67;
DPSBinObjGeneric obj68;
DPSBinObjGeneric obj69;
DPSBinObjGeneric obj70;
DPSBinObjReal obj71;
DPSBinObjGeneric obj72;
DPSBinObjGeneric obj73;
DPSBinObjGeneric obj74;
DPSBinObjGeneric obj75;
DPSBinObjGeneric obj76;
DPSBinObjGeneric obj77;
DPSBinObjGeneric obj78;
DPSBinObjGeneric obj79;
} _dpsQ;
static const _dpsQ _dpsStat = {
DPS_DEF_TOKENTYPE, 0, 70, 648,
{DPS_LITERAL|DPS_INT, 0, 0, 1},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 155}, /* setlinewidth */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 111}, /* newpath */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 107}, /* moveto */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: radius */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: startangle */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: endangle */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 5}, /* arc */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 22}, /* closepath */
{DPS_LITERAL|DPS_REAL, 0, 0, 1.415},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 346}, /* setmiterlimit */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 78}, /* gsave */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: grayshade */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 150}, /* setgray */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 66}, /* fill */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 77}, /* grestore */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 167}, /* stroke */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 78}, /* gsave */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: startangle */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: endangle */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 1}, /* add */
{DPS_LITERAL|DPS_INT, 0, 0, 2},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 54}, /* div */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 136}, /* rotate */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: radius */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 173}, /* translate */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 111}, /* newpath */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 107}, /* moveto */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: labelps */
{DPS_LITERAL|DPS_REAL, 0, 0, .8},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 108}, /* mul */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 99}, /* lineto */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 167}, /* stroke */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: labelps */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 173}, /* translate */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 172}, /* transform */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 77}, /* grestore */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 95}, /* itransform */
{DPS_LITERAL|DPS_NAME, 0, DPSSYSNAME, 426}, /* y */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 62}, /* exch */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51}, /* def */
{DPS_LITERAL|DPS_NAME, 0, DPSSYSNAME, 425}, /* x */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 62}, /* exch */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 51}, /* def */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 425}, /* x */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 426}, /* y */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 107}, /* moveto */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 425}, /* x */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 102}, /* lt */
{DPS_EXEC|DPS_ARRAY, 0, 6, 592},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 84}, /* if */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 426}, /* y */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 102}, /* lt */
{DPS_EXEC|DPS_ARRAY, 0, 4, 560},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 84}, /* if */
{DPS_LITERAL|DPS_STRING, 0, 0, 640}, /* param thelabel */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 160}, /* show */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: labelps */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 110}, /* neg */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 134}, /* rmoveto */
{DPS_LITERAL|DPS_STRING, 0, 0, 640}, /* param thelabel */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 166}, /* stringwidth */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 117}, /* pop */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 110}, /* neg */
{DPS_LITERAL|DPS_INT, 0, 0, 0},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 134}, /* rmoveto */
}; /* _dpsQ */
_dpsQ _dpsF; /* local copy */
register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
char pad[3];
register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
register int _dps_offset = 640;
_dpsF = _dpsStat; /* assign automatic variable */
_dpsP[16].val.realVal = grayshade;
_dpsP[8].val.realVal =
_dpsP[28].val.realVal = radius;
_dpsP[9].val.realVal =
_dpsP[22].val.realVal = startangle;
_dpsP[10].val.realVal =
_dpsP[23].val.realVal = endangle;
_dpsP[35].val.realVal =
_dpsP[41].val.realVal =
_dpsP[71].val.realVal = labelps;
_dpsP[74].length =
_dpsP[68].length = strlen(thelabel);
_dpsP[74].val.stringVal = _dps_offset;
_dps_offset += (_dpsP[74].length + 3) & ~3;
_dpsP[68].val.stringVal = _dps_offset;
_dps_offset += (_dpsP[68].length + 3) & ~3;
_dpsF.nBytes = _dps_offset+8;
DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,648);
DPSWriteStringChars(_dpsCurCtxt, (char *)thelabel, _dpsP[74].length);
DPSWriteStringChars(_dpsCurCtxt, (char *)pad, ~(_dpsP[74].length + 3) & 3);
DPSWriteStringChars(_dpsCurCtxt, (char *)thelabel, _dpsP[68].length);
DPSWriteStringChars(_dpsCurCtxt, (char *)pad, ~(_dpsP[68].length + 3) & 3);
if (0) *pad = 0; /* quiets compiler warnings */
}
#line 45 "slice.psw"